package com.atstudy.headline.entity;

import com.atstudy.headline.enums.BaseStatus;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * 广告创意表
 * @TableName ad_creatives
 */
@TableName(value ="ad_creatives")
@Data
public class AdCreatives {
    /**
     * 广告创意ID
     */
    @TableId(type = IdType.AUTO)
    private Integer creativeId;

    /**
     * 广告计划ID
     */
    private Integer campaignId;

    /**
     * 计划名称
     */
    @TableField(exist = false)
    private String campaignName;

    /**
     * 广告类型编码
     */
    private Integer adTypeCode;

    /**
     * 广告类型（关联base_dicts.dict_type）
     */
    private String adType;

    /**
     * 广告类型描述
     */
    @JsonProperty("adTypeDesc")
    @TableField(exist = false)
    private String adTypeDesc;

    /**
     * 广告标题
     */
    private String title;

    /**
     * 广告描述
     */
    private String description;

    /**
     * 媒体URL
     */
    private String mediaUrl;

    /**
     * 点击URL
     */
    private String clickUrl;

    /**
     * 展示顺序
     */
    private Integer displaySequence;

    /**
     * 状态（1:启用，0:禁用）
     */
    private BaseStatus status;

    /**
     * 展示次数
     */
    private Integer impressionCount;

    /**
     * 点击次数
     */
    private Integer clickCount;

    /**
     * 转化次数
     */
    private Integer conversionCount;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 级联标志
     */
    private int isCascade;

    /**
     * 广告计划状态
     */
    @TableField(exist = false)
    private int campaignsStatus;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        AdCreatives other = (AdCreatives) that;
        return (this.getCreativeId() == null ? other.getCreativeId() == null : this.getCreativeId().equals(other.getCreativeId()))
            && (this.getCampaignId() == null ? other.getCampaignId() == null : this.getCampaignId().equals(other.getCampaignId()))
            && (this.getAdTypeCode() == null ? other.getAdTypeCode() == null : this.getAdTypeCode().equals(other.getAdTypeCode()))
            && (this.getAdType() == null ? other.getAdType() == null : this.getAdType().equals(other.getAdType()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getMediaUrl() == null ? other.getMediaUrl() == null : this.getMediaUrl().equals(other.getMediaUrl()))
            && (this.getClickUrl() == null ? other.getClickUrl() == null : this.getClickUrl().equals(other.getClickUrl()))
            && (this.getDisplaySequence() == null ? other.getDisplaySequence() == null : this.getDisplaySequence().equals(other.getDisplaySequence()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getImpressionCount() == null ? other.getImpressionCount() == null : this.getImpressionCount().equals(other.getImpressionCount()))
            && (this.getClickCount() == null ? other.getClickCount() == null : this.getClickCount().equals(other.getClickCount()))
            && (this.getConversionCount() == null ? other.getConversionCount() == null : this.getConversionCount().equals(other.getConversionCount()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCreativeId() == null) ? 0 : getCreativeId().hashCode());
        result = prime * result + ((getCampaignId() == null) ? 0 : getCampaignId().hashCode());
        result = prime * result + ((getAdTypeCode() == null) ? 0 : getAdTypeCode().hashCode());
        result = prime * result + ((getAdType() == null) ? 0 : getAdType().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getMediaUrl() == null) ? 0 : getMediaUrl().hashCode());
        result = prime * result + ((getClickUrl() == null) ? 0 : getClickUrl().hashCode());
        result = prime * result + ((getDisplaySequence() == null) ? 0 : getDisplaySequence().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getImpressionCount() == null) ? 0 : getImpressionCount().hashCode());
        result = prime * result + ((getClickCount() == null) ? 0 : getClickCount().hashCode());
        result = prime * result + ((getConversionCount() == null) ? 0 : getConversionCount().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", creativeId=").append(creativeId);
        sb.append(", campaignId=").append(campaignId);
        sb.append(", adTypeCode=").append(adTypeCode);
        sb.append(", adType=").append(adType);
        sb.append(", title=").append(title);
        sb.append(", description=").append(description);
        sb.append(", mediaUrl=").append(mediaUrl);
        sb.append(", clickUrl=").append(clickUrl);
        sb.append(", displaySequence=").append(displaySequence);
        sb.append(", status=").append(status);
        sb.append(", impressionCount=").append(impressionCount);
        sb.append(", clickCount=").append(clickCount);
        sb.append(", conversionCount=").append(conversionCount);
        sb.append(", createTime=").append(createTime);
        sb.append("]");
        return sb.toString();
    }
}
